import http from '@/utils/axios';

// 获取列表
export const getRoleList = (params?: any) => {
    return http({
        method: 'get',
        url: '/role/index',
        params,
    });
};

// 获取信息
export const getRoleInfo = (id: number) => {
    return http({
        method: 'GET',
        url: `/role/read/${id}`,
    });
};

// 新增信息
export const saveRoleInfo = (data: any) => {
    return http({
        method: 'POST',
        url: `/role/save`,
        data,
    });
};

// 更新信息
export const updateRoleInfo = (id: number, data: any) => {
    return http({
        method: 'PUT',
        url: `/role/update/${id}`,
        data,
    });
};

// 设置权限
export const setRoleAuth = (id: number, data: any) => {
    return http({
        method: 'PUT',
        url: `/role/setRoleAuth/${id}`,
        data,
    });
};

// 删除角色
export const deleteRole = (id: number) => {
    return http({
        method: 'DELETE',
        url: `/role/delete/${id}`,
    });
};